package com.meida.module.bus.provider.service;

import com.meida.common.mybatis.base.service.IBaseService;
import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.module.bus.client.entity.BusReport;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * 月报 接口
 *
 * @author flyme
 * @date 2020-11-04
 */
public interface BusReportService extends IBaseService<BusReport> {

    //截止上月确认数量
    EntityMap sumAsOfLMonthSupplierNum(Long projectId, String majorCode, String packageNo, Long supplierId);

    //获取某包商已上报的量
    EntityMap sumHaveReportSupplierNum(Long projectId, String majorCode, String packageNo, Long supplierId, Long materialId);

    //某分包数据下某月全部包商量合计
    EntityMap sumHaveReportAllSupplierNum(EntityMap params, String month, List<Long> busProjectSupplierIds);

    //某分包数据下某月全部包商量合计
    EntityMap sumHaveReportAllSupplierNumAsOfMonth(EntityMap params, String month, List<Long> busProjectSupplierIds);

    //取最大月份
    String getMaxReportMonth(EntityMap params);

    //获取某个根节点所有填报数据
    List<BusReport> selectBusReportList(Map params);

    List<BusReport> selectBusReportListData(List<Long> materialIdList);

    //导入月报
    ResultBody importBusReport(MultipartFile file, Map params) throws Exception;

    //保存月报后的计算处理
    void saveBusReportAfter(EntityMap params, Integer reportType);

    //获取临时版本数据
    ResultBody getPreViewData(Map params);

    //同步临时版本数据
    ResultBody syncData(Map params) throws Exception;

    /**
     * 修改记录的审核状态
     * @param state
     * @param reports
     * @return
     */
    void mergeAuditState(int state, List<BusReport> reports);
}
